package cn.miao;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

/**
 * @program: springcloud-hrm
 * @description:
 * @author: MiaoWei
 * @create: 2021-12-02 19:48
 **/
//@RunWith(SpringRunner.class)
@SpringBootTest()
public class test {
    @Test
    public void test() throws Exception{
        //起始
        Date date = new Date();
        //截止
        DateTime dateTime = DateUtil.offsetMinute(date, 1);
        //小<大  正数
        //截止<起始  负数
        System.out.println(DateUtil.between(dateTime,date, DateUnit.MINUTE,false));
    }
}
